import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
import {fileURLToPath} from 'url';

export default defineConfig({
  plugins: [vue()], resolve: {
    alias: {
      "@": fileURLToPath(new URL("./src", import.meta.url)),
    },
  }, server: {
    proxy: {
      '/api': {
        target: 'http://localhost:8080',
        secure: false,
        changeOrigin: true,
        // 进行路径重写，以/api开头的路径代表请求后端动态资源
        rewrite: (path) => path.replace(/^\/api/, ''),
      }
    }
  }
})
